package main;

import processing.core.PApplet;

public class Recursion extends PApplet {

    @Override
    public void settings() {
        size(640,360);
    }

    @Override
    public void setup() {
        noStroke();
        noLoop();
    }

    @Override
    public void draw() {
        drawCircle(width/ 2, 280, 7);
    }

    public void drawCircle(int x, int radius, int level) {
        float tt = 126 * level / 4.0f;
        // what is that tt means?
        fill(tt);
        ellipse(x, height/2f, radius* 2, radius*2);
        if(level > 1) {
            level--;
            drawCircle(x - radius/2, radius/2, level);
            drawCircle(x + radius/2, radius/2, level);
        }
    }
}
